<template>
	<!-- 顶部选项卡 -->
	<view class="tabs">
		<view 
			class="uni-tab-item" 
			v-for="(tab,index) in tabBars"
			:key="tab.id"
		>
			<text 
				class="uni-tab-item-title"
				:class="{tabActive: tabIndex==tab.id}"
				@tap="tarTap(tab)"
			>
				{{tab.name}}
				<span class="tab-item-title-line"></span>
				
			</text>
		</view>
	</view>
</template>
 
<script>
	export default {
		name: "index-tabbar",
		props:{
			tabBars: Array,
			tabIndex: String
		},
		data(){
			return {
				
			}
		},
		methods:{
			tarTap(item){
				this.$emit("TarTap",item)
			}
		}
	}
</script>
 
<style>
	.tabs{
		display: flex;
		flex: 1;
		flex-direction: row;
		overflow-x: scroll;
		height: 100%;
	}
	.uni-tab-item{
		width: 100%;
		white-space: nowrap;
		line-height: 75rpx;
		height: 75rpx;
		border-bottom: 1px solid #eee;
	}
	.uni-tab-item-title{
		font-family: "微软雅黑";
		color: #c1c1c1; 
		font-weight: normal;
		font-size: 20 rpx; //38
		width: 150rpx;
		display: inline-block;
		text-align: center;
		color: #555;
	}
	.tabActive{
		color: #3f484d;
		font-weight: bold;
	}
	.tabActive .tab-item-title-line{
		display: block;
		border-bottom: 2rpx solid #387dfc;
		border-top: 2rpx solid #387dfc;
		width: 86rpx;
		margin: 0 auto;
		border-radius: 40rpx;
		margin-top: -10px;
		background-color: #387dfc;
		box-sizing: border-box;
	}
</style>
